#comments-start - More Info Dialog
[SCRIPT NAME]Launch Web Page
Description:
    - Launches the specified browser to any specified pages.

Arguments:
    - Arg1: Browser [Optional] - e.g. iexplore, firefox, chrome, etc
        - Default:
            - iexplore
    - Arg2: Spaced delimited URIs [Optional] e.g. http://www.google.com http://www.byond.com
    - Arg3: Attach to existing IE window [Optional]
        - Options:
            - True (Default)
            - False
        - Other browsers handle how they want new URIs opened so view the tab settings in your preferred browser.
        - If set to true, the script will try to attach to an existing IE window. If false, it will open a new instance of IE.
        - This setting is ignored for all other browsers.
#comments-end - More Info Dialog
#include <Include\WinClickPro.au3>
#include <Include\IE.au3>

Func Main()
	Local $sBrowserName = ""
	Local $sParameters = ""
	Local $sShowFlag = -1 ; // Default is invalid value and will be replaced with @Macro or ignored.
	Local $sDelimitedListOfSites = ""
	Local $sAttachToExistingIE = 1 ; Default

	;
	; This script has 1 required argument and 2 optional.
	;
	If $CmdLine[0] < 1 Then
		_DisplayErrorAndExit("Invalid argument count detected!" & @LF & "Count: " & $CmdLine[0])
	EndIf

	;
	; Use default or user defined value for browser
	;
	If $CmdLine[1] == "" Then
		$sBrowserName = "iexplore"
	Else
		$sBrowserName = StringLower($CmdLine[1])
	EndIf

	If $CmdLine[0] > 1 Then
		$sParameters = $CmdLine[2]
	EndIf

	If $CmdLine[0] > 2 Then
		$sAttachToExistingIE = StringLower($CmdLine[3])
		;
		; Does the user want to attach to an existing IE process?
		;
		If $sAttachToExistingIE == "" Or $sAttachToExistingIE == "true" Then
			$sAttachToExistingIE = 1
		ElseIf $sAttachToExistingIE == "false" Then
			$sAttachToExistingIE = 0
		Else
			_DisplayErrorAndExit("Invalid value specified for ""Attach to existing IE window""" & @LF & "Vale: " & $sAttachToExistingIE)
		EndIf
	EndIf

	;
	; If IE, break the URIs into a delimited string so we can execute them one at a time
	;
	If $sBrowserName == "iexplore" Then
		$sDelimitedListOfSites = StringSplit($sParameters, " ")
	EndIf

	;
	; If IE, do one thing, for all other browsers do another
	;
	If $sBrowserName == "iexplore" Then
		$oIE = _IECreate($sDelimitedListOfSites[1],$sAttachToExistingIE,1,0)
		;
		; Opens new tabs to the URIs in this instance of IE
		;
		For $i = 2 To $sDelimitedListOfSites[0]
			$oIE.Navigate2($sDelimitedListOfSites[$i], 2048)
		Next
	Else
		ShellExecute($sBrowserName, $sParameters, "", "open")
	EndIf
EndFunc

Main()
Exit